#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void Print(int n)
{
	for (int i = 30; i >= 0; i-=2)
	{
		printf("%d ", n >> i & 1);

	}
	printf("\n");
	for (int i = 31; i >= 1; i -= 2)
	{
		printf("%d ", n >> i & 1);
	}
}


int main()
{
	int n = 0;
	scanf("%d", &n);
	Print(n);

	return 0;
}